Component({
  behaviors: [],
  properties: {

  },
  data: {
    schoolList: ['清华大学', '北京大学', '复旦大学'],
    schoolIndex: 0,
    majorList: ['计算机科学', '经济学', '法学'],
    majorIndex: 0,
    promotionCount: 0,
    promotionFee: 0
  },
  lifetimes: {
    created() {

    },
    attached() {

    },
    moved() {

    },
    detached() {

    },
  },
  methods: {
    onSchoolChange(e) {
      this.setData({
        schoolIndex: e.detail.value
      });
      this.updatePromotionInfo();
      this.triggerEvent('schoolChange', { schoolIndex: this.data.schoolIndex });
    },
    onMajorChange(e) {
      this.setData({
        majorIndex: e.detail.value
      });
      this.updatePromotionInfo();
      this.triggerEvent('majorChange', { majorIndex: this.data.majorIndex });
    },
    updatePromotionInfo() {
      // 这里可根据实际业务逻辑动态计算
      const count = 100 + this.data.schoolIndex * 50 + this.data.majorIndex * 20;
      const fee = count * 0.5;
      this.setData({
        promotionCount: count,
        promotionFee: fee.toFixed(2)
      });
    },
    onClose() {
      this.triggerEvent('remove');
    }
  },
});
